4
4
.
.
1
1
.
.
2
2
C
C
r
r
e
e
a
a
t
t
e
e
T
T
e
e
s
s
t
t
C
C
l
l
a
a
s
s
s
s
-
-
A
A
u
u
t
t
o
o
m
m
a
a
t
t
i
i
c
c
a
a
l
l
l
l
y
y
I
I
n
n
f
f
o
o
This tutorial shows how IntelliJ can automatically create Test Class by selecting Methods you want to test.
IntelliJ will create new Test Class under main\test\com.ivoronline.springboot_junit
created Test Class will have the same name as the Class that contains selected Methods but with additional Test suffix
(if selected Methods were from the Class Person then IntelliJ will create Test Class named PersonTest)
IntelliJ will also recreate the same Packages
(if Class Person was in the Package entities, then Class PersonTest will also be placed in the Package entities)
Content
Create Test Class
Result
C
C
r
r
e
e
a
a
t
t
e
e
T
T
e
e
s
s
t
t
C
C
l
l
a
a
s
s
s
s
Choose one
RC on Class - Show Context Actions (on Class which Methods you want to test)
LC on Class - Alt + Enter
Create Test
Select Methods (which you want to test)
OK (creates Test Class under the same Package structure as Class being tested)
RC on Class
Select Methods (which you want to test)
R
R
e
e
s
s
u
u
l
l
t
t
Automatically created Test Class (with the same Package structure)